package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

// 只在方法上添加 @LagouSecurity 注解
@LagouController
@LagouRequestMapping("/methodDemo")
public class MethodTestController {

    @LagouAutowired
    private IDemoService demoService;

    @LagouRequestMapping("/query1")
    public String query1(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }

    @LagouSecurity({"zhangsan"})
    @LagouRequestMapping("/query2")
    public String query2(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }

    @LagouSecurity({"zhangsan", "lisi"})
    @LagouRequestMapping("/query3")
    public String query3(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }
}



































